package com.pmsystem.controller;

import java.util.ArrayList;
import java.util.List;

import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Controller;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RequestMethod;

import com.pmsystem.service.BatchService;

/**
 * 
* <p>Title: BatchController</p>  
* <p>Description:批量操作的控制器 </p>  
* @author 树昌  
* @date 2019年1月26日
 */
@Controller
public class BatchController {

	
	@Autowired
	BatchService batchService;
	
	
	@RequestMapping(value="batchVBR",method=RequestMethod.GET)
	public String batchAddVBR(/*List<String> villagename,int buildingnum,int floornum,int roomnum*/) {
		
//		boolean row = batchService.batchAddVBR(villagename, buildingnum, floornum, roomnum);
		
		List<String> listname = new ArrayList<>();
		
		listname.add("依云小镇");
		listname.add("美丽水乡");
		listname.add("丽日豪庭");
		listname.add("阳光小镇");
		listname.add("仙溪别墅");

		boolean row = batchService.batchAddVBR(listname, 5, 8, 12);

		if (row) {
			return "success";
		} else {
			return "error";
		}
	}
	
	
	@RequestMapping(value="batchRoomKey",method=RequestMethod.GET)
	public String batchRoomKey(/*int keynum*/) {
		
		boolean row = batchService.batchAddRoomKey(3);
		if(row) {
			return "Information/success";
		}else {
			return "error";
		}
	}
	
}
